package com.leyou.item.mapper;

import com.leyou.item.entity.Sku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.Mapper;

public interface SkuMapper extends Mapper<Sku>, InsertListMapper<Sku>, SelectByIdListMapper<Sku,Long> {
    @Update("UPDATE tb_sku set stock = stock - #{num} where id = #{skuId} ")
    void minusSkuStock(@Param("skuId") Long skuId, @Param("num") Integer num);

    @Update("UPDATE tb_sku set stock = stock + #{num} where id = #{skuId} ")
    void plusSkuStock(@Param("skuId") Long skuId, @Param("num") Integer num);
}
